var objApi = {
	get: function(data){
		data.type = "GET";
		this._makeRequest(data);
	},
	post: function(data){
		data.type = "POST";
		this._makeRequest(data);
	},
	_makeRequest: function(data){

		data.url = "/api" + data.url;
		data.error = data.error || this._handleError;

		if(typeof(data.success) === "undefined") {
			throw "No success callback given" 
		}

		console.log(data.data);

		//perform the request
		jQuery.ajax(data);
	},
	_handleError: function(response){
		console.log(response);
		jQuery('#error-box').html(response.data.msg);
		jQuery('#error-box').show();
	}
};